using System;
using EPiServer.Common;
using EPiServer.Common.Queries;
using EPiServer.Common.Security;
using EPiServer.Community.Blog;
using EPiServer.Community.Blog.Queries;

namespace EPiAbstractions.Community.Blog
{
    public interface IBlogHandlerFacade
    {
        EPiServer.Community.Blog.Blog GetBlog(Int32 id);

        BlogCollection GetBlogs(Int32 page, Int32 pageSize, BlogSortOrder[] order);

        BlogCollection GetBlogs(Int32 page, Int32 pageSize, out Int32 totalItems, BlogSortOrder[] order);

        BlogCollection GetBlogs(NullValueAction siteNullAction, Int32 page, Int32 pageSize, BlogSortOrder[] order);

        BlogCollection GetBlogs(NullValueAction siteNullAction, Int32 page, Int32 pageSize, out Int32 totalItems, BlogSortOrder[] order);

        BlogCollection GetBlogs(SiteCollection sites, Int32 page, Int32 pageSize, BlogSortOrder[] order);

        BlogCollection GetBlogs(SiteCollection sites, Int32 page, Int32 pageSize, out Int32 totalItems, BlogSortOrder[] order);

        BlogCollection GetBlogs(SiteCollection sites, NullValueAction siteNullAction, Int32 page, Int32 pageSize, BlogSortOrder[] order);

        BlogCollection GetBlogs(SiteCollection sites, NullValueAction siteNullAction, Int32 page, Int32 pageSize, out Int32 totalItems,
                                BlogSortOrder[] order);

        BlogCollection GetBlogs(BlogType blogType, SiteCollection sites, Int32 page, Int32 pageSize, BlogSortOrder[] order);

        BlogCollection GetBlogs(BlogType blogType, SiteCollection sites, Int32 page, Int32 pageSize, out Int32 totalItems,
                                BlogSortOrder[] order);

        BlogCollection GetBlogs(BlogType blogType, SiteCollection sites, NullValueAction siteNullAction, Int32 page, Int32 pageSize,
                                BlogSortOrder[] order);

        BlogCollection GetBlogs(BlogType blogType, SiteCollection sites, NullValueAction siteNullAction, Int32 page, Int32 pageSize,
                                out Int32 totalItems, BlogSortOrder[] order);

        EPiServer.Community.Blog.Blog AddBlog(EPiServer.Community.Blog.Blog blog);

        void UpdateBlog(EPiServer.Community.Blog.Blog blog);

        void RemoveBlog(EPiServer.Community.Blog.Blog blog);

        Entry GetEntry(Int32 id);

        void UpdateEntryCommentsAsRead(Entry entry);

        void AddEntryVisit(Entry entry);

        EntryVisit GetEntryVisit(Entry entry);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, Int32 page, Int32 pageSize, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, Int32 page, Int32 pageSize, out Int32 totalItems,
                                   EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, ReadStatus readStatus, IUser user, Int32 page, Int32 pageSize,
                                   EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, ReadStatus readStatus, IUser user, Int32 page, Int32 pageSize,
                                   out Int32 totalItems, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, ReadStatus readStatus, IUser user, DateTime fromDate, DateTime toDate,
                                   EntryPublishState publishState, Int32 page, Int32 pageSize, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, ReadStatus readStatus, IUser user, DateTime fromDate, DateTime toDate,
                                   EntryPublishState publishState, Int32 page, Int32 pageSize, out Int32 totalItems,
                                   EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, ReadStatus readStatus, IUser user, DateTime fromDate, DateTime toDate,
                                   EntryPublishState publishState, Boolean byPublishDate, Int32 page, Int32 pageSize,
                                   EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(EPiServer.Community.Blog.Blog blog, ReadStatus readStatus, IUser user, DateTime fromDate, DateTime toDate,
                                   EntryPublishState publishState, Boolean byPublishDate, Int32 page, Int32 pageSize, out Int32 totalItems,
                                   EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(BlogType blogType, Int32 page, Int32 pageSize, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(BlogType blogType, Int32 page, Int32 pageSize, out Int32 totalItems, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(BlogType blogType, DateTime fromDate, DateTime toDate, EntryPublishState publishState, Int32 page,
                                   Int32 pageSize, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(BlogType blogType, DateTime fromDate, DateTime toDate, EntryPublishState publishState, Int32 page,
                                   Int32 pageSize, out Int32 totalItems, EntrySortOrder[] sortOrder);

        EntryCollection GetEntriesByPublishDate(BlogType blogType, DateTime fromDate, DateTime toDate, Int32 page, Int32 pageSize,
                                                EntrySortOrder[] sortOrder);

        EntryCollection GetEntriesByPublishDate(BlogType blogType, DateTime fromDate, DateTime toDate, Int32 page, Int32 pageSize,
                                                out Int32 totalItems, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(BlogType blogType, DateTime fromDate, DateTime toDate, EntryPublishState publishState,
                                   Boolean byPublicationDate, Int32 page, Int32 pageSize, EntrySortOrder[] sortOrder);

        EntryCollection GetEntries(BlogType blogType, DateTime fromDate, DateTime toDate, EntryPublishState publishState,
                                   Boolean byPublicationDate, Int32 page, Int32 pageSize, out Int32 totalItems, EntrySortOrder[] sortOrder);

        Entry AddEntry(Entry entry);

        void UpdateEntry(Entry entry);

        void RemoveEntry(Entry entry);

        void SetBlogLastReadDate(IUser user, EPiServer.Community.Blog.Blog blog);

        EntryComment AddEntryComment(EntryComment entryComment);

        void UpdateEntryComment(EntryComment entryComment);

        void RemoveEntryComment(EntryComment entryComment);

        EntryComment GetEntryComment(Int32 id);

        EntryCommentCollection GetEntryComments(Entry entry, Int32 page, Int32 pageSize, EntryCommentSortOrder[] sortOrder);

        EntryCommentCollection GetEntryComments(Entry entry, Int32 page, Int32 pageSize, out Int32 totalItems,
                                                EntryCommentSortOrder[] sortOrder);

        event EPiServerCommonEventHandler BlogAdded;

        event EPiServerCommonEventHandler BlogAddedActive;

        event EPiServerCommonEventHandler BlogAddedNotActive;

        event EPiServerCommonEventHandler BlogUpdated;

        event EPiServerCommonEventHandler BlogRemoved;

        event EPiServerCommonEventHandler EntryAdded;

        event EPiServerCommonEventHandler EntryUpdated;

        event EPiServerCommonEventHandler EntryRemoved;

        event EPiServerCommonEventHandler BlogRead;

        event EPiServerCommonEventHandler EntryCommentAdded;

        event EPiServerCommonEventHandler EntryCommentUpdated;

        event EPiServerCommonEventHandler EntryCommentRemoved;

        BlogCollection GetQueryResult(BlogQuery query);

        BlogCollection GetQueryResult(BlogQuery query, Int32 page, Int32 pageSize);

        BlogCollection GetQueryResult(BlogQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);

        EntryCollection GetQueryResult(EntryQuery query);

        EntryCollection GetQueryResult(EntryQuery query, Int32 page, Int32 pageSize);

        EntryCollection GetQueryResult(EntryQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);

        EntryCommentCollection GetQueryResult(EntryCommentQuery query);

        EntryCommentCollection GetQueryResult(EntryCommentQuery query, Int32 page, Int32 pageSize);

        EntryCommentCollection GetQueryResult(EntryCommentQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);
    }
}